// sku模块接口管理
import request from '@/utils/request'
import { SkuResponseData } from './type'

// 枚举接口地址
enum API {
  // 获取已有的sku列表
  GETSKU_URL = "/admin/product/list/",
  // 上架sku
  ONSALE_URL = "/admin/product/onSale/",
  // 下架sku
  CANCELSALE_URL = "/admin/product/cancelSale/",
  // 获取SKU详情
  SKUINFO_URL = "/admin/product/getSkuInfo/",
  // 删除SKU
  DELETESKU_URL = "/admin/product/deleteSku/"
}

// 获取已有的sku列表请求方法
export const reqSkuList = (currentPage: number, pageSize: number) =>
  request.get<any, SkuResponseData>(API.GETSKU_URL + `${currentPage}/${pageSize}`)
// 下架sku
export const reqCancelSale = (skuId: number) =>
  request.get<any, any>(API.CANCELSALE_URL + skuId)
// 上架sku
export const reqOnSale = (skuId: number) =>
  request.get<any, any>(API.ONSALE_URL + skuId)
// 获取SKU详情
export const reqSkuInfo = (skuId: number) =>
  request.get<any, any>(API.SKUINFO_URL + skuId)
// 删除SKU
export const reqDeleteSku = (skuId: number) =>
  request.delete<any, any>(API.DELETESKU_URL + skuId)

